# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem              1.0

name                    webp
version                 1.1.0
revision                0
checksums               rmd160  c84f99c0045b0f066fb8599225b340016039ade6 \
                        sha256  98a052268cc4d5ece27f76572a7f50293f439c17a98e67c4ea0c7ed6f50ef043 \
                        size    4033877

categories              graphics science devel
platforms               darwin
maintainers             {ryandesign @ryandesign} openmaintainer
license                 BSD

description             image format library providing lossy compression \
                        for photographic images

long_description        WebP is a new image format that provides lossy \
                        compression for photographic images. In a large \
                        scale study of 900,000 web images, WebP images \
                        were 39.8% smaller than jpeg images of similar \
                        quality. \
                        \
                        A WebP file consists of VP8 image data, and a \
                        container based on RIFF. Webmasters, web developers \
                        and browser developers can use the WebP format \
                        to create smaller, better-looking images that can \
                        help make the web faster.

homepage                https://developers.google.com/speed/webp/
master_sites            http://downloads.webmproject.org/releases/webp/

depends_lib             port:giflib \
                        path:lib/libjpeg.dylib:jpeg \
                        port:libpng \
                        port:tiff

distname                libwebp-${version}

patchfiles              configure.patch

configure.args-append   --disable-silent-rules \
                        --disable-wic \
                        --enable-gif \
                        --enable-jpeg \
                        --enable-libwebpdecoder \
                        --enable-libwebpdemux \
                        --enable-libwebpextras \
                        --enable-libwebpmux \
                        --enable-png \
                        --enable-tiff

# https://bugs.chromium.org/p/webp/issues/detail?id=366
configure.args-append   --disable-sdl

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 0644 -W ${worksrcpath} \
        AUTHORS \
        ChangeLog \
        COPYING \
        NEWS \
        PATENTS \
        README \
        README.mux \
        ${docdir}
}

variant debug description {Compile with debugging information and reduce optimization level} {
    configure.optflags -O1
    configure.cflags-append -ggdb
    configure.cxxflags-append -ggdb
}

livecheck.type          regex
livecheck.url           ${homepage}download
livecheck.regex         /libwebp-(\[0-9.\]+)${extract.suffix}
